#include<stdio.h>
#include<malloc.h>
struct Node{
	int data;
	struct Node *next;
}; 
int main()
{
	struct Node *node,*temp,*p,*head,*older,*news;
	int count;
	node=(struct Node *) malloc(sizeof(struct Node));
	head=node;
	int n,t;
	scanf("%d",&n);
	while(1)
	{
		scanf("%d",&t);
		if(t<0) break;
		count++;
		temp=(struct Node *) malloc(sizeof(struct Node));
		temp->data=t;
		temp->next=NULL;
		node->next=temp;
		node=node->next;
	}
	if(count<n) 
	{
		printf("NULL");return 0;
	}
	head=head->next;
	news=NULL;
	older=head;
	while(older)
	{
		temp=older->next;
		older->next=news;
		news=older;
		older=temp;
	}
	count=0;
	while(1)
	{
		count++;
		if(count==n) 
		{
			printf("%d",news->data);return 0;
		}
		news=news->next;
	}
}
